<?php
class Admin_payed_invoice extends CI_Model
{
	function __construct()
	{
		parent::__construct();
	}
	
	function CheckIfOcrExists($ocr)
	{
		$sqlCommand='select * from bokning where ocrNummer=?';
		$result=$this->db->query($sqlCommand,array($ocr));
		
		if($result->num_rows()==1)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	
	function CheckIfPriceIsRight($ocr,$price)
	{
		$sqlCommand='select * from bokning where ocrNummer=? and totalPrice=?';
		$result=$this->db->query($sqlCommand,array($ocr,$price));
		
		if($result->num_rows()==1)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
		
	}
	
	function UpdateToPayed($ocr)
	{
		$sqlCommand="update bokning set betald='1' where ocrNummer=?";
		$result=$this->db->query($sqlCommand,array($ocr));
		if($result)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	
}